#include "hexdialog.h"
#include <iostream>

#ifndef Log
#define Log(x) std::cout << x << std::endl
#endif

HexDialog::HexDialog()
{
    //ctor
}

HexDialog::~HexDialog()
{
    //dtor
    OnCloseWindow();
}

void HexDialog::OnCancel()
{
    Log("The user has pressed the cancel button");
}

void HexDialog::OnOK()
{
    Log("OK button pressed, saving changes...");
}

void HexDialog::OnKeyPress(char key)
{
    if (key == '\n')
        return; //skip

    m_listOfKeysPressed += key;

    if (key == 'x')
        Log("Yes, X Japan pega!");
    else
        Log("The key " << key << " has been pressed!");
}

void HexDialog::OnSize(int w, int h)
{
    if (0 < w && w < 150)
        Log("The width value is: " << w);
    else
        Log("The width value must be between 0 and 150");

    if (0 < h && h < 120)
        Log("The height value is: " << h);
    else
        Log("The height value must be between 0 and 120");
}

void HexDialog::OnStateChanged(wxDialog::State state)
{
    switch(state)
    {
    case wxDialog::Minimized:
        Log("The window is now Minimized");
        break;
    case wxDialog::Maximized:
        Log("The window has been Maximized");
        break;
    default:
        Log("I guess the window should be Normal now");
        break;
    }
}

void HexDialog::OnCloseWindow()
{
    Log("The window is closing...");
    Log("The list of keys pressed was: '" << m_listOfKeysPressed << "'.");
    Log("The window is closed.");
}
